package com.fand.platform.userCenter.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import lombok.val;

import org.apache.commons.lang3.StringUtils;

import com.fand.dto.PaginationDto;
import com.fand.persistent.builder.ModelArgs;
import com.fand.persistent.builder.ModelBuilder;
import com.fand.persistent.builder.ModelBuilderUtils;
import com.fand.persistent.support.DaoJdbcSupport;
import com.fand.platform.userCenter.dto.UserDto;
import com.fand.platform.userCenter.dto.UserLoDto;
import com.fand.platform.userCenter.dto.UserLoInDto;
import com.fand.platform.userCenter.dto.UserLoInLoDto;
import com.fand.platform.userCenter.dto.UserReDto;
import com.fand.platform.userCenter.dto.UserReLoDto;

/**
 * 用户
 *
 * @author yaoHT
 * 
 */
public class UserJdbcDao extends DaoJdbcSupport implements UserDao {

	@Override
	public int insertUserBy1(UserDto insertUser, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUser, insertProperties));
		return this.update("userCenter/user/insertUserBy1", modelBuilder.build());
	}

	@Override
	public int insertUserBy1_1(UserDto insertUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUser));
				
		return this.update("userCenter/user/insertUserBy1", modelBuilder.build());
	}

	@Override
	public int insertUserBy2(UserDto insertUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUser));

		return this.update("userCenter/user/insertUserBy2", modelBuilder.build());
	}

	@Override
	public int deleteUserBy1(UserDto deleteUser, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUser,
				whereEqProperties));

		return this.update("userCenter/user/deleteUserBy1", modelBuilder.build());
	}
	@Override
	public int deleteUserBy1_1(UserDto deleteUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUser));

		return this.update("userCenter/user/deleteUserBy1", modelBuilder.build());
	}
	
	@Override
	public int deleteUserByIds(UserDto deleteUser) {
		val model = new HashMap<String, Object>();

		model.put("IDS", deleteUser.getIds());

		return this.update("userCenter/user/deleteUserByIds", model);
	}

	@Override
	public int updateUserBy1(UserDto updateUser, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateUser, updateProperties), new ModelArgs(updateUser, whereEqProperties));

		return this.update("userCenter/user/updateUserBy1", modelBuilder.build());
	}

	@Override
	public int updateUserBy1_1(UserDto updateUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateUser));

		return this.update("userCenter/user/updateUserBy1", modelBuilder.build());
	}
	
	@Override
	public int updateUserBy2(UserDto updateUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateUser));

		return this.update("userCenter/user/updateUserBy2", modelBuilder.build());
	}

	@Override
	public <R> R selectUserBy1ForObject(Class<R> requiredType, UserDto selectUser, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/user/selectUserBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserBy1_1ForObject(Class<R> requiredType, UserDto selectUser, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForObject(requiredType, "userCenter/user/selectUserBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserBy2ForObject(Class<R> requiredType, UserDto selectUser, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForObject(requiredType, "userCenter/user/selectUserBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserBy1ForObjectList(Class<R> requiredType, UserDto selectUser, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/user/selectUserBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserBy1_1ForObjectList(Class<R> requiredType, UserDto selectUser, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForObjectList(requiredType, "userCenter/user/selectUserBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserBy2ForObjectList(Class<R> requiredType, UserDto selectUser, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForObjectList(requiredType, "userCenter/user/selectUserBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserBy1ForMappedObject(Class<R> mappedClass, UserDto selectUser,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/user/selectUserBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserBy1_1ForMappedObject(Class<R> mappedClass, UserDto selectUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForMappedObject(mappedClass, "userCenter/user/selectUserBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserBy2ForMappedObject(Class<R> mappedClass, UserDto selectUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForMappedObject(mappedClass, "userCenter/user/selectUserBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int selectUserByCodeNqIdForInteger(UserDto selectUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder();

//		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder().putExtend(null, "code", null,
//				selectUser.getCode());

//		if (StringUtils.isNotBlank(selectUser.getId())) {
//			modelBuilder.putExtend(ModelBuilder.WHERE__AND__NQ, "id", null, selectUser.getId());
//		}

		return this.selectForObject(Integer.class, "userCenter/user/selectUserBy1ForObject", null,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserBy1ForMappedObjectList(Class<R> mappedClass, UserDto selectUser,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/user/selectUserBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserBy1_1ForMappedObjectList(Class<R> mappedClass, UserDto selectUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForMappedObjectList(mappedClass, "userCenter/user/selectUserBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserBy2ForMappedObjectList(Class<R> mappedClass, UserDto selectUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUser));

		return this.selectForMappedObjectList(mappedClass, "userCenter/user/selectUserBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> PaginationDto<R> paginationUserBy1ForMappedObjectList(Class<R> mappedClass,
				UserDto paginationUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationUser));

		return this.paginationForMappedObjectList(mappedClass, "userCenter/user/selectUserBy1ForObject",
				"userCenter/user/selectUserBy1ForMappedObjectList",
				paginationUser.getPaginationNo(),
				paginationUser.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public PaginationDto<Map<String, Object>> paginationUserBy1ForMapList(UserDto paginationUser) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationUser));

		return this.paginationForMapList("userCenter/user/selectUserBy1ForObject",
				"userCenter/user/selectUserBy1ForMappedObjectList",
				paginationUser.getPaginationNo(),
				paginationUser.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public int insertUserLoBy1(UserLoDto insertUserLo, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserLo, insertProperties));
		return this.update("userCenter/userLo/insertUserLoBy1", modelBuilder.build());
	}

	@Override
	public int deleteUserLoBy1(UserLoDto deleteUserLo, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUserLo,
				whereEqProperties));

		return this.update("userCenter/userLo/deleteUserLoBy1", modelBuilder.build());
	}

	@Override
	public int updateUserLoBy1(UserLoDto updateUserLo, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateUserLo, updateProperties), new ModelArgs(updateUserLo, whereEqProperties));

		return this.update("userCenter/userLo/updateUserLoBy1", modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoBy1ForObject(Class<R> requiredType, UserLoDto selectUserLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLo,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/userLo/selectUserLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoBy1ForObjectList(Class<R> requiredType, UserLoDto selectUserLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLo,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/userLo/selectUserLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoBy1ForMappedObject(Class<R> mappedClass, UserLoDto selectUserLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/userLo/selectUserLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoBy1ForMappedObjectList(Class<R> mappedClass, UserLoDto selectUserLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/userLo/selectUserLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int insertUserLoInBy1(UserLoInDto insertUserLoIn, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserLoIn, insertProperties));
		return this.update("userCenter/userLoIn/insertUserLoInBy1", modelBuilder.build());
	}

	@Override
	public int insertUserLoInBy1_1(UserLoInDto insertUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserLoIn));
				
		return this.update("userCenter/userLoIn/insertUserLoInBy1", modelBuilder.build());
	}

	@Override
	public int insertUserLoInBy2(UserLoInDto insertUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserLoIn));

		return this.update("userCenter/userLoIn/insertUserLoInBy2", modelBuilder.build());
	}

	@Override
	public int deleteUserLoInBy1(UserLoInDto deleteUserLoIn, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUserLoIn,
				whereEqProperties));

		return this.update("userCenter/userLoIn/deleteUserLoInBy1", modelBuilder.build());
	}
	@Override
	public int deleteUserLoInBy1_1(UserLoInDto deleteUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUserLoIn));

		return this.update("userCenter/userLoIn/deleteUserLoInBy1", modelBuilder.build());
	}
	
	@Override
	public int deleteUserLoInByIds(UserLoInDto deleteUserLoIn) {
		val model = new HashMap<String, Object>();

		model.put("IDS", deleteUserLoIn.getIds());

		return this.update("userCenter/userLoIn/deleteUserLoInByIds", model);
	}

	@Override
	public int updateUserLoInBy1(UserLoInDto updateUserLoIn, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateUserLoIn, updateProperties), new ModelArgs(updateUserLoIn, whereEqProperties));

		return this.update("userCenter/userLoIn/updateUserLoInBy1", modelBuilder.build());
	}

	@Override
	public int updateUserLoInBy1_1(UserLoInDto updateUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateUserLoIn));

		return this.update("userCenter/userLoIn/updateUserLoInBy1", modelBuilder.build());
	}
	
	@Override
	public int updateUserLoInBy2(UserLoInDto updateUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateUserLoIn));

		return this.update("userCenter/userLoIn/updateUserLoInBy2", modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInBy1ForObject(Class<R> requiredType, UserLoInDto selectUserLoIn, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/userLoIn/selectUserLoInBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInBy1_1ForObject(Class<R> requiredType, UserLoInDto selectUserLoIn, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForObject(requiredType, "userCenter/userLoIn/selectUserLoInBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInBy2ForObject(Class<R> requiredType, UserLoInDto selectUserLoIn, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForObject(requiredType, "userCenter/userLoIn/selectUserLoInBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInBy1ForObjectList(Class<R> requiredType, UserLoInDto selectUserLoIn, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/userLoIn/selectUserLoInBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInBy1_1ForObjectList(Class<R> requiredType, UserLoInDto selectUserLoIn, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForObjectList(requiredType, "userCenter/userLoIn/selectUserLoInBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInBy2ForObjectList(Class<R> requiredType, UserLoInDto selectUserLoIn, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForObjectList(requiredType, "userCenter/userLoIn/selectUserLoInBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInBy1ForMappedObject(Class<R> mappedClass, UserLoInDto selectUserLoIn,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/userLoIn/selectUserLoInBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInBy1_1ForMappedObject(Class<R> mappedClass, UserLoInDto selectUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForMappedObject(mappedClass, "userCenter/userLoIn/selectUserLoInBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInBy2ForMappedObject(Class<R> mappedClass, UserLoInDto selectUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForMappedObject(mappedClass, "userCenter/userLoIn/selectUserLoInBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int selectUserLoInByCodeNqIdForInteger(UserLoInDto selectUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder();

//		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder().putExtend(null, "code", null,
//				selectUserLoIn.getCode());

//		if (StringUtils.isNotBlank(selectUserLoIn.getId())) {
//			modelBuilder.putExtend(ModelBuilder.WHERE__AND__NQ, "id", null, selectUserLoIn.getId());
//		}

		return this.selectForObject(Integer.class, "userCenter/userLoIn/selectUserLoInBy1ForObject", null,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInBy1ForMappedObjectList(Class<R> mappedClass, UserLoInDto selectUserLoIn,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/userLoIn/selectUserLoInBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInBy1_1ForMappedObjectList(Class<R> mappedClass, UserLoInDto selectUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForMappedObjectList(mappedClass, "userCenter/userLoIn/selectUserLoInBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInBy2ForMappedObjectList(Class<R> mappedClass, UserLoInDto selectUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoIn));

		return this.selectForMappedObjectList(mappedClass, "userCenter/userLoIn/selectUserLoInBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> PaginationDto<R> paginationUserLoInBy1ForMappedObjectList(Class<R> mappedClass,
				UserLoInDto paginationUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationUserLoIn));

		return this.paginationForMappedObjectList(mappedClass, "userCenter/userLoIn/selectUserLoInBy1ForObject",
				"userCenter/userLoIn/selectUserLoInBy1ForMappedObjectList",
				paginationUserLoIn.getPaginationNo(),
				paginationUserLoIn.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public PaginationDto<Map<String, Object>> paginationUserLoInBy1ForMapList(UserLoInDto paginationUserLoIn) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationUserLoIn));

		return this.paginationForMapList("userCenter/userLoIn/selectUserLoInBy1ForObject",
				"userCenter/userLoIn/selectUserLoInBy1ForMappedObjectList",
				paginationUserLoIn.getPaginationNo(),
				paginationUserLoIn.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public int insertUserLoInLoBy1(UserLoInLoDto insertUserLoInLo, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserLoInLo, insertProperties));
		return this.update("userCenter/userLoInLo/insertUserLoInLoBy1", modelBuilder.build());
	}

	@Override
	public int deleteUserLoInLoBy1(UserLoInLoDto deleteUserLoInLo, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUserLoInLo,
				whereEqProperties));

		return this.update("userCenter/userLoInLo/deleteUserLoInLoBy1", modelBuilder.build());
	}

	@Override
	public int updateUserLoInLoBy1(UserLoInLoDto updateUserLoInLo, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateUserLoInLo, updateProperties), new ModelArgs(updateUserLoInLo, whereEqProperties));

		return this.update("userCenter/userLoInLo/updateUserLoInLoBy1", modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInLoBy1ForObject(Class<R> requiredType, UserLoInLoDto selectUserLoInLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoInLo,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/userLoInLo/selectUserLoInLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInLoBy1ForObjectList(Class<R> requiredType, UserLoInLoDto selectUserLoInLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoInLo,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/userLoInLo/selectUserLoInLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserLoInLoBy1ForMappedObject(Class<R> mappedClass, UserLoInLoDto selectUserLoInLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoInLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/userLoInLo/selectUserLoInLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserLoInLoBy1ForMappedObjectList(Class<R> mappedClass, UserLoInLoDto selectUserLoInLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserLoInLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/userLoInLo/selectUserLoInLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int insertUserReBy1(UserReDto insertUserRe, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserRe, insertProperties));
		return this.update("userCenter/userRe/insertUserReBy1", modelBuilder.build());
	}

	@Override
	public int insertUserReBy1_1(UserReDto insertUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserRe));
				
		return this.update("userCenter/userRe/insertUserReBy1", modelBuilder.build());
	}

	@Override
	public int insertUserReBy2(UserReDto insertUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserRe));

		return this.update("userCenter/userRe/insertUserReBy2", modelBuilder.build());
	}

	@Override
	public int deleteUserReBy1(UserReDto deleteUserRe, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUserRe,
				whereEqProperties));

		return this.update("userCenter/userRe/deleteUserReBy1", modelBuilder.build());
	}
	@Override
	public int deleteUserReBy1_1(UserReDto deleteUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUserRe));

		return this.update("userCenter/userRe/deleteUserReBy1", modelBuilder.build());
	}
	
	@Override
	public int deleteUserReByIds(UserReDto deleteUserRe) {
		val model = new HashMap<String, Object>();

		model.put("IDS", deleteUserRe.getIds());

		return this.update("userCenter/userRe/deleteUserReByIds", model);
	}

	@Override
	public int updateUserReBy1(UserReDto updateUserRe, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateUserRe, updateProperties), new ModelArgs(updateUserRe, whereEqProperties));

		return this.update("userCenter/userRe/updateUserReBy1", modelBuilder.build());
	}

	@Override
	public int updateUserReBy1_1(UserReDto updateUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateUserRe));

		return this.update("userCenter/userRe/updateUserReBy1", modelBuilder.build());
	}
	
	@Override
	public int updateUserReBy2(UserReDto updateUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(updateUserRe));

		return this.update("userCenter/userRe/updateUserReBy2", modelBuilder.build());
	}

	@Override
	public <R> R selectUserReBy1ForObject(Class<R> requiredType, UserReDto selectUserRe, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/userRe/selectUserReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserReBy1_1ForObject(Class<R> requiredType, UserReDto selectUserRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForObject(requiredType, "userCenter/userRe/selectUserReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserReBy2ForObject(Class<R> requiredType, UserReDto selectUserRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForObject(requiredType, "userCenter/userRe/selectUserReBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReBy1ForObjectList(Class<R> requiredType, UserReDto selectUserRe, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/userRe/selectUserReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReBy1_1ForObjectList(Class<R> requiredType, UserReDto selectUserRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForObjectList(requiredType, "userCenter/userRe/selectUserReBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReBy2ForObjectList(Class<R> requiredType, UserReDto selectUserRe, String objectId) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForObjectList(requiredType, "userCenter/userRe/selectUserReBy2ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserReBy1ForMappedObject(Class<R> mappedClass, UserReDto selectUserRe,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/userRe/selectUserReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserReBy1_1ForMappedObject(Class<R> mappedClass, UserReDto selectUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForMappedObject(mappedClass, "userCenter/userRe/selectUserReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserReBy2ForMappedObject(Class<R> mappedClass, UserReDto selectUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForMappedObject(mappedClass, "userCenter/userRe/selectUserReBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public int selectUserReByCodeNqIdForInteger(UserReDto selectUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder();

//		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder().putExtend(null, "code", null,
//				selectUserRe.getCode());

//		if (StringUtils.isNotBlank(selectUserRe.getId())) {
//			modelBuilder.putExtend(ModelBuilder.WHERE__AND__NQ, "id", null, selectUserRe.getId());
//		}

		return this.selectForObject(Integer.class, "userCenter/userRe/selectUserReBy1ForObject", null,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReBy1ForMappedObjectList(Class<R> mappedClass, UserReDto selectUserRe,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/userRe/selectUserReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReBy1_1ForMappedObjectList(Class<R> mappedClass, UserReDto selectUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForMappedObjectList(mappedClass, "userCenter/userRe/selectUserReBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReBy2ForMappedObjectList(Class<R> mappedClass, UserReDto selectUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserRe));

		return this.selectForMappedObjectList(mappedClass, "userCenter/userRe/selectUserReBy2ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> PaginationDto<R> paginationUserReBy1ForMappedObjectList(Class<R> mappedClass,
				UserReDto paginationUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationUserRe));

		return this.paginationForMappedObjectList(mappedClass, "userCenter/userRe/selectUserReBy1ForObject",
				"userCenter/userRe/selectUserReBy1ForMappedObjectList",
				paginationUserRe.getPaginationNo(),
				paginationUserRe.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public PaginationDto<Map<String, Object>> paginationUserReBy1ForMapList(UserReDto paginationUserRe) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(paginationUserRe));

		return this.paginationForMapList("userCenter/userRe/selectUserReBy1ForObject",
				"userCenter/userRe/selectUserReBy1ForMappedObjectList",
				paginationUserRe.getPaginationNo(),
				paginationUserRe.getPaginationSize(),
				modelBuilder.build());
	}

	@Override
	public int insertUserReLoBy1(UserReLoDto insertUserReLo, String... insertProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.INSERT,
				insertUserReLo, insertProperties));
		return this.update("userCenter/userReLo/insertUserReLoBy1", modelBuilder.build());
	}

	@Override
	public int deleteUserReLoBy1(UserReLoDto deleteUserReLo, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(deleteUserReLo,
				whereEqProperties));

		return this.update("userCenter/userReLo/deleteUserReLoBy1", modelBuilder.build());
	}

	@Override
	public int updateUserReLoBy1(UserReLoDto updateUserReLo, String[] updateProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(ModelBuilder.UPDATE,
				updateUserReLo, updateProperties), new ModelArgs(updateUserReLo, whereEqProperties));

		return this.update("userCenter/userReLo/updateUserReLoBy1", modelBuilder.build());
	}

	@Override
	public <R> R selectUserReLoBy1ForObject(Class<R> requiredType, UserReLoDto selectUserReLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserReLo,
				whereEqProperties));

		return this.selectForObject(requiredType, "userCenter/userReLo/selectUserReLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReLoBy1ForObjectList(Class<R> requiredType, UserReLoDto selectUserReLo, String objectId,
			String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserReLo,
				whereEqProperties));

		return this.selectForObjectList(requiredType, "userCenter/userReLo/selectUserReLoBy1ForObject", objectId,
				modelBuilder.build());
	}

	@Override
	public <R> R selectUserReLoBy1ForMappedObject(Class<R> mappedClass, UserReLoDto selectUserReLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserReLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObject(mappedClass, "userCenter/userReLo/selectUserReLoBy1ForMappedObjectList",
				modelBuilder.build());
	}

	@Override
	public <R> List<R> selectUserReLoBy1ForMappedObjectList(Class<R> mappedClass, UserReLoDto selectUserReLo,
			String[] selectProperties, String... whereEqProperties) {
		final ModelBuilder modelBuilder = ModelBuilderUtils.newModelBuilder(new ModelArgs(selectUserReLo,
				whereEqProperties));

		modelBuilder.putTrueExtend(ModelBuilder.SELECT, selectProperties);

		return this.selectForMappedObjectList(mappedClass, "userCenter/userReLo/selectUserReLoBy1ForMappedObjectList",
				modelBuilder.build());
	}
}